<div id="productModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="width:800px;margin-left:-400px;">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel">编辑赠品</h3>
  </div>
  <div class="modal-body">
	<form method="post" action="__ACTION__?id={$data.id}" data-validate="true" data-continue="true" data-submit="ajax" class="form-horizontal edit-form js-submit-form">	
		<div class="form-group">
			<div class="form-item">
				<div class="control-group">
				    <label class="control-label must">活动名称</label>
				    <div class="controls">
				      <input type="text" name="title" value="{$data.title}" placeholder="50个字符以内" maxlength="50" required="required">
				      <input type="hidden" name="product_id" value="{$data.product_id}">
				      <input type="hidden" name="id" value="{$data.id}">
				    </div>
				</div>
				<div class="control-group">
				    <label class="control-label must">活动开始时间</label>
				    <div class="controls">
				      <div class="input-append date" data-format="yyyy-MM-dd hh:mm:ss">
						<input type="text" name="start_time" value="{$data.start_time}" required="required" readonly="readonly">
						<span class="add-on"><i data-time-icon="icon-time" data-date-icon="icon-calendar"></i></span>
					  </div>
				    </div>
				</div>
				<div class="control-group">
				    <label class="control-label must">活动结束时间</label>
				    <div class="controls">
				      <div class="input-append date" data-format="yyyy-MM-dd hh:mm:ss">
						<input type="text" name="end_time" value="{$data.end_time}" required="required" readonly="readonly">
						<span class="add-on"><i data-time-icon="icon-time" data-date-icon="icon-calendar"></i></span>
					  </div>
				    </div>
				</div>
			</div>
			<div class="form-item">
				<div class="control-group">
				    <label class="control-label must">领取有效期</label>
				    <div class="controls">
						<input type="number" name="expiration_day" value="{$data.expiration_day}" required="required" data-rule-digits="digits" max="30" min="1"> 天
				    </div>
				</div>
				<div class="control-group">
				    <label class="control-label must">领取限制</label>
				    <div class="controls">
						<input type="number" name="buy_quota" value="{$data.buy_quota}" required="required" data-rule-digits="digits" min="1"> 次/人
				    </div>
				</div>
				<div class="control-group">
				    <label class="control-label must">赠品数量</label>
				    <div class="controls">
						<input type="number" name="stock" value="{$data.stock}" required="required" data-rule-digits="digits" max="1000" min="1"> 件
				    </div>
				</div>
			</div>
		</div>
		
		<div>
			<table id="productTable" class="table table-hover">
			    <thead>
					<tr>
						<th data-width="400" data-field="title">产品名称</th>
						<th data-width="150" data-field="spec">规格型号</th>
						<th data-field="stock" data-align="center">剩余库存</th>
					</tr>
					<tr>
						<td>{$data.product_title}</td>
						<td>{$data.sku_name}</td>
						<td>{$data.product_stock}</td>
					</tr>
				</thead>
			</table>
		</div>
	</form>
  </div>
  <div class="modal-footer">
    <button type="button" class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
    <button type="button" class="btn btn-primary js-save">保存</button>
  </div>
</div>
<script type="text/javascript">
(function(){
	var $modal = $('#productModal'),
		$form = $modal.find('.js-submit-form');
	    $modal.find('.js-save').on('click', function(){
		if(!$form.valid()){
			return false;
		}
		$form.submit();
		return false;
	});
})();
</script>


